const path = require('path');
const CopyWebpackPlugin = require("copy-webpack-plugin");
const config = require("./webpack.base.config");
const TerserPlugin = require('terser-webpack-plugin');

// 拷贝文件
const copyPlugin = new CopyWebpackPlugin([
    {
        from: __dirname + '/html-template/index.html',
        to: __dirname + '/dist/staging/index.html'
    }
]);

const uglifyJsPlugin = new TerserPlugin({
    terserOptions: {
        output: {
            comments: false,
        },
    },
});


config.plugins.push(copyPlugin, uglifyJsPlugin);

// config.optimization.minimizer = [uglifyJsPlugin];

config.output.path = path.join(__dirname, "dist/staging");


module.exports = config;